package com.cms.controller;


import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;


/**
*@author:gang
*@version:
**/
@Controller
@RequestMapping("/test")
public class ELAction {
	
	String mapString = "map";
	String name="ant-black";
	String id="11111";
	int age = 22;
	Date date = new Date();
	static HashMap<String, String> elMap = new HashMap<String, String>();
	static LinkedList<String> elList = new LinkedList<String>();
	static String[][] arry={{"S1","S2","S3"},{"S4","S5","S6"}};
	
	@RequestMapping("/EL")
	public String modelEl(HttpServletRequest request,ModelMap map){
		return "eltest";
	}  
	//测试el的作用域
	@RequestMapping("/elscope")
	public String elscope(HttpServletRequest request,ModelMap map){
		HttpSession session = request.getSession();
		session.setAttribute("id", id);
		request.setAttribute("name1", name);
		return "elscope";
	} 
	//测试el的隐含对象
	@RequestMapping("/elobject")
	public String elobject(HttpServletRequest request,ModelMap map){
		HttpSession session = request.getSession();
		session.setAttribute("map", map);
		return "elobject";
	} 
	//测试el的函数方法
	@RequestMapping("/elfunction")
	public String elfunction(HttpServletRequest request,ModelMap map){
		HttpSession session = request.getSession();
		request.setAttribute("name", name);
		return "elfunction";
	} 
	
    
  public static long localNowDate(){
      Date date = new Date();
      Long dateString = date.getYear()+date.getTime();
      return dateString;
  }
  
  public static Map<String, String> elmap(){
	  elMap.put("001", "aaa");
	  elMap.put("002", "bbb");
	  elMap.put("003", "ccc");
      return elMap;
  }
  
  public static LinkedList<String> ellist(){
	  elList.add("list1");
	  elList.add("list2");
	  elList.add("list3");
	  elList.add("list4");
	  return elList;
  }
  
  public static String[][] funcAlert(){
      return arry;
  }
  
  public static String funcString(){
	  String string = "String success";
      return string;
  }
	
}
